package sii.fb.emotion.computProbability;

import java.util.List;
import java.util.Map;

import sii.fb.emotion.Main;
import sii.fb.emotion.bean.Post;
import sii.fb.emotion.bean.User;

public class ProbabilityBasedOnGender {
		
	//Probability of occurrences of emotions in status updates from female and male users
		public void gender2Emotion(Map<Long, User> users, Map<Long, List<Post>> posts){
			SupportMethod cp = new SupportMethod();
			User u;
			Float[] emot_female =  new Float[]{0F,0F,0F,0F,0F,0F,0F,0F,0F,0F,0F};
			Float[] emot_male = new Float[]{0F,0F,0F,0F,0F,0F,0F,0F,0F,0F,0F};
			int post_female = 0;
			int post_male = 0;
			String gender;
			for(Long l:posts.keySet()){
				u = users.get(l);
				gender = u.getGender();		
				List<Post> post = posts.get(l);
				if(gender.equals("female")){
					post_female +=post.size();
				}else{
					post_male +=post.size();
				}
				for(Post p: post){
					float[] emotionPost = p.getEmotion();
					if(gender.equals("female")){
						cp.updateEmotionArray(emotionPost, emot_female);
					}else{
						cp.updateEmotionArray(emotionPost, emot_male);
					}
				}
			}
			Main.print += ("----------FEMALE----------");	

			cp.normalizeListPostEm(emot_female, post_female); 
			Main.print += ("----------MALE----------");	

			cp.normalizeListPostEm(emot_male, post_male);	
		}


}
